//
//  LocalDataIntegrateViewController.m
//  SDKSample
//
//  Created by 小肥羊 on 15/6/3.
//  Copyright (c) 2015年 Zhu‘s Game House. All rights reserved.
//

#import "LocalDataIntegrateViewController.h"

@interface LocalDataIntegrateViewController ()

@end

@implementation LocalDataIntegrateViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)viewWillAppear:(BOOL)animated
{
    [XFYLocalData openDB];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [XFYLocalData closeDB];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)addData:(UIButton *)sender {
    [[XFYLocalData sharedManager] addFragmentData:self.dataText.text];
}

- (IBAction)modifyData:(UIButton *)sender {
    [[XFYLocalData sharedManager] modifyFragmentData:self.dataText.text fragmentData:self.dataText2.text];
}

- (IBAction)deleteData:(UIButton *)sender {
    [[XFYLocalData sharedManager] deleteFragmentData:self.dataText.text];
}


- (IBAction)selectData:(UIButton *)sender {
    FMResultSet *data = [[XFYLocalData sharedManager] searchAllFragmentData];
    while ([data next]) {
        NSString *fragmentData = [data objectForColumnName:@"FragmentData"];
        NSLog(@"%@",fragmentData);
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
